package demo.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import demo.dao.ICategoryDao;
import demo.model.Category;

@RestController
@RequestMapping("category")
public class CategoryController {

	
	@Resource
	private ICategoryDao categoryDao;
	
	@RequestMapping("add.do")
	public Integer add(Category c){
		return categoryDao.add(c);
	}
	
	@RequestMapping("del.do")
	public Integer del(Integer id){
		return categoryDao.del(id);
	}
	
	@RequestMapping("findAll.do")
	public Map findAll(){
		Map map = new HashMap();
		map.put("code", "0");
		map.put("msg", "");
		map.put("count", 100);
		map.put("data", categoryDao.findAll());
		return map;
	}
}
